<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- InstanceBegin template="/Templates/anydbtest.dwt" codeOutsideHTMLIsLocked="false" -->
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Cheatsheet of AnyDbTest</title>
    <!-- InstanceEndEditable -->
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta name="AnyDbTest" content="AnyDbTest Technology">
     
    <meta name="robots" content="index,follow">
    <meta name="generator" content="AnyDbTest">
    <meta name="author" content="AnyDbTest Technology">
    <meta name="rating" content="General">
    <meta name="revisit-after" content="2 days">
    <meta name="classification" content="Science &amp; Technology">
    <meta name="distribution" content="Global">
    <link rel="stylesheet" type="text/css" href="style.css">
    <!-- InstanceBeginEditable name="head" -->
    <meta name="keywords" content="AnyDbTest, UnitTest, Database UnitTest, DB UnitTest, Database automatic test,  Unit test, Database Unit test, DB Unit test, DB automatic test - AnyDbTest Technology">
    <meta name="description" content="AnyDbTest Technology is devoted to developing intuitive, easy-to-use application and database software products for different categories of users. ">
    <!-- InstanceEndEditable -->

    <script type="text/JavaScript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
    </script>
    
    <link rel="stylesheet" type="text/css" href="csharp.css">

</head>
<body>
    <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="3">
                <img src="images/logo.png" width="960" height="87" border="0" usemap="#Map" onclick="MM_preloadImages('images/logo.png')" />
            </td>
        </tr>
        <tr>
            <td width="9" background="images/layout/site-left.gif">
                &nbsp;
            </td>
            <td width="942" height="37" background="images/layout/menu-bg.gif" onfocus="MM_preloadImages('images/layout/menu-bg.gif')">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                        <tr>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="index.html">Home</a></div>
                            </td>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="product.html">Product</a></div>
                            </td>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="download.html">Download</a></div>
                            </td>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="purchase.html">Purchase</a></div>
                            </td>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="support.html">Support</a></div>
                            </td>
                            <td class="MenuTop" width="120">
                                <div align="center">
                                    <a href="tutorial.html">Tutorial</a></div>
                            </td>
                            <!--
            <td class="MenuTop" width="120">
            <div align="center"><a href="affiliate.html">Affiliate</a></div>
            </td>
            -->
                        </tr>
                    </tbody>
                </table>
            </td>
            <td width="10" background="images/layout/site-right.gif">
                &nbsp;
            </td>
        </tr>
            <tr>
                <td colspan="3" background="images/layout/site-bg.gif">
                    <table border="0" cellpadding="0" cellspacing="0" width="960">
                        <tbody>
                            <tr>
                                <td height="50" width="9">
                                    &nbsp;
                                </td>
                                <td  class="productText" bgcolor="#ffffff" valign="top" width="716">
                                    <div class="LeftColumnPadding">
                                        <!-- InstanceBeginEditable name="LeftRegion" -->
                                        <h2>Content of cheat sheet <a name="SheetCheatContent" id="SheetCheatContent"></a></h2>
                                        <table width="95%" border="0" cellpadding="2" cellspacing="0">
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/dot.gif" width="14" height="10" /> 
                                                </td>
                                                <td>
                                                    <strong>Part 1</strong>
                                                </td>
                                            </tr>
                                            
											<tr height="25">
                                                <td>
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetGuiRunnerCmdLine">AnyDbTest GuiRunner command line</a>
                                                </td>
                                            </tr>
											
											
                                            <tr height="25">
                                                <td>
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetPerformanceTest">Perform performance test</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td>
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetSetupProcess">Setup and Teardown</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetIgnoreTestCase">Ignore one test ad-hoc in test file</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetNotCareResultset">How to run one uncompleted unit testing case</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetTestQuerySQL">Test query SQL statement</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetTestStoredFunc">Test stored function</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetTestDML">Test DML statement</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetCompRecordDiffCount">Compare two record sets with different field count</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetCompRecordDiffName">Compare two record sets with different field name</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet.html#SheetShowDiffDialog">Show set-style and sequential-style comparison for unit test</a>
                                                </td>
                                            </tr>
                                            
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/dot.gif" width="14" height="10" /> 
                                                </td>
                                                <td>
                                                    <strong>Part 2</strong>
                                                </td>
                                            </tr>
                                            
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetSandbox">Sandbox test (aka. AutoRollBack)</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetSharedConnFile">Use shared DB Connection file</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetExportXml">Export data set into XML</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetConvertToExcel">Convert XML-fomat data file into Excel format</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetUseExcelReference">How to use Excel as reference test data</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetCrossDbTest">Cross database test</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetCompareRefereceDB">Cross database test-Compare target result set with reference DB</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetPumpReferenceDB">Cross database test-Pump data from reference DB</a>
                                                </td>
                                            </tr>
                                            
                                            <tr height="25">
                                                <td width="2%">
                                                    <img src="images/bullet.gif" width="24" height="14" />
                                                </td>
                                                <td>
                                                    <a href="TutorialCheatSheet2.html#SheetValidateETL">Validate replication, ETL, DTS and SSIS tasks</a>
                                                </td>
                                            </tr>
                                        </table>
                                        
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tbody>
											
<tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                AnyDbTest GuiRunner Command Line<a name="SheetGuiRunnerCmdLine" id="SheetGuiRunnerCmdLine"></a>
                                                            </h2>
															Command line usage:
															<br />
															<br />
															<b><i>AnyDbTest &nbsp;&nbsp;testCaseFile &nbsp;&nbsp;[options]</i></b>
															<br />
															<br />
															<br />
															options: 
															<br />
															<br />
															/runScope=&lt;scopeType&gt; &nbsp;  --Run automatically which test cases when GuiRunner loaded , by default scopeType is All.
															<br />
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;scopeType&gt;= All | PerfTest| UnitTest | None
															<br />
															<br />
															/help  &nbsp; --Show this help message   
													        <br />		
															<br />		
															The following line is a sample.
															<br />
															<br />
															<b><i>AnyDbTest &nbsp;&nbsp;c:\AnyDbTest\TestCases\EtlValidation.xml  &nbsp;&nbsp;/runScope=All</i></b>
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>
												
											
											
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Perform performance test <a name="SheetPerformanceTest" id="SheetPerformanceTest"></a>
                                                            </h2>
                                                            Performance testing gives you an approach to measure how long your stored procedures or SQL statements will take in your environment.  What do you need to do is to tell AnyDbTest which statement will be tested and what values are for input-type arguments. The following XML is performance test case to diagnose how long the usp_GetStatesInCountry takes to run.
                                                            <br /> 
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">perfTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="PT_Fetch_USA_States"</span> 
              <span class="attr">statementAlias</span><span class="kwrd">="proc_Get_state_in_country"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
    test how long it takes to execute usp_GetStatesInCountry
  <span class="kwrd">&lt;/</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">perfTestCase</span><span class="kwrd">&gt;</span>
</pre>                                                  
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                    </td>
                                                </tr>
                                                
                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Setup and Teardown<a name="CheatSetupProcess" id="CheatSetupProcess"></a>
                                                            </h2>
                                                            In AnyDbTest, we have an opportunity to run some code just before a test method runs, and just after a test method finished. The former process often is called setup process, and the latter one is called teardown process. 
                                                            <br />
                                                            <br />
                                                            In AnyDbTest, there are two kinds of action in setup and teardown section. They separately are normal SQL statement and data pump action. You can add more than one action in each setup/teardown section. 
                                                            <br />
                                                            <br />
                                                            Normal statement action is to execute one SQL or stored procedure. Data pump action is to transfer data from one database into another database, or transfer data from one table into another table on the same database.  We will illustrate data pump action in next chapters. 
                                                            <br />
                                                            <br />
                                                            The following code is illustrating how to use setup and teardown in performance testing case. Similarly, it also is not hard to use them in unit testing case.  
                                                            <br /> 
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">perfTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="PT_Demo_Setup"</span>
              <span class="attr">statementAlias</span><span class="kwrd">="sql_GetCountryRegion"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
    to demo how to use setup and teardown
  <span class="kwrd">&lt;/</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="CountryCode"</span> <span class="attr">value</span><span class="kwrd">="XX"</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>

  <span class="kwrd">&lt;</span><span class="html">setup</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">statement</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_InsertRegion"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@countryCode"</span> <span class="attr">value</span><span class="kwrd">="XX"</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@countryName"</span> <span class="attr">value</span><span class="kwrd">="dummy country"</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">remark</span><span class="kwrd">&gt;</span>
        insert one country, its code called XX
      <span class="kwrd">&lt;/</span><span class="html">remark</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">statement</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">setup</span><span class="kwrd">&gt;</span>

  <span class="kwrd">&lt;</span><span class="html">teardown</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">statement</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_DeleteRegion"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">remark</span><span class="kwrd">&gt;</span>
        to delete the country inserted in setup section
      <span class="kwrd">&lt;/</span><span class="html">remark</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@countryCode"</span> <span class="attr">value</span><span class="kwrd">="XX"</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">statement</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">teardown</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">perfTestCase</span><span class="kwrd">&gt;</span>
</pre>                                                            
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>
                                                

                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Ignore one test ad-hoc in test file<a name="SheetIgnoreTestCase" id="SheetIgnoreTestCase"></a>
                                                            </h2>
                                                            If you want to ignore one test temporarily, it is very easy. You need only add an extra<strong> ignoreThis </strong>attribute in test case section. And set the ignoreThis attribute as true (By default, the attribute value is false). This feature is applicable to both performance test and unit test.  AnyDbTest will load such test cases no longer. 
                                                            <br /> 
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">perfTestCases</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">perfTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="PT_Fetch_USA_States"</span> 
                <span class="attr">statementAlias</span><span class="kwrd">="proc_Get_state_in_country"</span> 
                <span class="attr">ignoreThis</span><span class="kwrd">="true"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
      To test it take how long to execute usp_GetStatesInCountry
    <span class="kwrd">&lt;/</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">perfTestCase</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">perfTestCases</span><span class="kwrd">&gt;</span></pre>                                                            
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>                                                
                                                
                                                
                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                How to run one uncompleted unit testing case<a name="SheetNotCareResultset" id="SheetNotCareResultset"></a>
                                                            </h2>
                                                            AnyDbTest has one special assertion namely <strong>NotCareResultset</strong>. Those cases with this assertion will pass when the targetResultset, referenceResultset, setup and teardown can execute without error. It will not compare the results held by targetResultset and referenceResultset. 
                                                            <br />
                                                            <br />
                                                            It is useful to have this so that when you run the test, you know that you have not yet completed working on the test. It is a marker for work remaining to be done.
                                                            <br />
                                                            <br />
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Test query SQL statement<a name="SheetTestQuerySQL" id="SheetTestQuerySQL"></a>
                                                            </h2>
                                                            Query SQL statements are those SQL statements which will return scalar value or record set. Let us illustrate by two examples. 
                                                            <br />
                                                            <br />
                                                            In the first example, we will test one SQL which returns one scalar value. The statement is, 
                                                            <br /> 
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">Select</span> <span class="kwrd">count</span>(*) <span class="kwrd">from</span> Person.CountryRegion;</pre>
                                                            Its declaration section is,
                                                            <br />     
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">sqlDeclaration</span> <span class="attr">alias</span><span class="kwrd">="sql_GetCountOfAllRegion"</span> <span class="attr">dbConnection</span><span class="kwrd">="db1"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">sql</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;!</span>[CDATA[select count(*) from [Person].[CountryRegion]]]<span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">sql</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">arguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@returnValue"</span> <span class="attr">direction</span><span class="kwrd">="Return"</span> 
              <span class="attr">type</span><span class="kwrd">="MSSQL_INT"</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">arguments</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">sqlDeclaration</span><span class="kwrd">&gt;</span>
</pre>
                                                        We can use the following unit testing to assert the query result is constant of 238. 
                                                        <br /> 
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">unitTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="UT_TestScalarQuery"</span> 
              <span class="attr">assertion</span><span class="kwrd">="StrictEqual"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">targetResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_GetCountOfAllRegion"</span> 
                   <span class="attr">outputArgument</span><span class="kwrd">="@returnValue"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">targetResultset</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">referenceResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_get_const_number"</span> 
                      <span class="attr">outputArgument</span><span class="kwrd">="result"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@constant"</span> <span class="attr">value</span><span class="kwrd">="238"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">referenceResultset</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">unitTestCase</span><span class="kwrd">&gt;</span></pre>       
                                                        
                                                        In the second example, we need to test one SQL which returns one record set. The statement is,                                                 
                                                        <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">Select</span> * <span class="kwrd">from</span> Person.CountryRegion;</pre>
                                                        Its declaration section is,
                                                        <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">sqlDeclaration</span> <span class="attr">alias</span><span class="kwrd">="sql_RetrieveAllRegion"</span> <span class="attr">dbConnection</span><span class="kwrd">="db1"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">sql</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;!</span>[CDATA[select * from [Person].[CountryRegion]]]<span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">sql</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">arguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@returnTable"</span> <span class="attr">direction</span><span class="kwrd">="Return"</span> 
              <span class="attr">type</span><span class="kwrd">="MSSQL_RECORDSET"</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">arguments</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">sqlDeclaration</span><span class="kwrd">&gt;</span></pre>
                                                       We can use the following unit testing to assert record count of the query is constant of 238. 
                                                       <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">unitTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="UT_TestRecordsetQuery"</span> 
              <span class="attr">assertion</span><span class="kwrd">="RecordCountEqual"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">targetResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_RetrieveAllRegion"</span> 
                   <span class="attr">outputArgument</span><span class="kwrd">="@returnTable"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">targetResultset</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">referenceResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_get_const_number"</span> 
                      <span class="attr">outputArgument</span><span class="kwrd">="result"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@constant"</span> <span class="attr">value</span><span class="kwrd">="238"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">referenceResultset</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">unitTestCase</span><span class="kwrd">&gt;</span></pre>                                                       
                                                        
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>     
                                                

                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Test stored function<a name="SheetTestStoredFunc" id="SheetTestStoredFunc"></a>
                                                            </h2>
                                                            For Oracle, the method to test stored procedure is also applicable to test stored function. First all, we need add a procDeclaration section for the stored functions. Then we can use it in performance testing case or unit testing case. 
                                                            <br />                                                            
                                                            <br />
                                                            For SQL Server or MySQL, it is recommend using one query SQL statement to test the stored function. Take two examples, we have two functions, one namely fun_get_scalar() returns scalar value, another namely fun_get_recordset() returns recordset. 
                                                            <br />
                                                            <br />
                                                            For fun_get_scalar(), we can use the following query SQL statement, 
                                                            <br />                                                            
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">Select</span> fun_get_scalar();</pre>                                                            
                                                            For fun_get_recordset(), we can use the following query SQL statement to test.
                                                            <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">Select</span> * <span class="kwrd">from</span> fun_get_recordset() ;</pre>                                                            
                                                            Now, we can test the original stored function by testing the corresponding query SQL statement. Please look in the <a href="TutorialCheatSheet.html#SheetTestQuerySQL"> Test query SQL statement</a> chapter.
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>                                                     
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Test DML statement<a name="SheetTestDML" id="SheetTestDML"></a>
                                                            </h2>
                                                            How to verify one DML statement (include simple DML statement and DML-style stored procedure) in one unit test case?  
                                                            <br />
                                                            <br />
                                                            Because such a statement will not return any result set, we should to construct one corresponding query statement to reflect effect of the DML statement. Then choose one suitable assertion and validate the query statement result in unit testing case. 
                                                            <br />
                                                            <br />
                                                            For example, we want to test the following stored procedure. 
                                                            <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
/*
Purpose: <span class="kwrd">To</span> <span class="kwrd">update</span> one country region  
*/ 
<span class="kwrd">drop</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_UpdateCountryRegion]
<span class="kwrd">go</span> 
<span class="kwrd">create</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_UpdateCountryRegion]
    @CountryRegionCode <span class="kwrd">nchar</span>(3), @Name <span class="kwrd">nchar</span>(50) 
<span class="kwrd">AS</span>
<span class="kwrd">BEGIN</span>     
    <span class="kwrd">Delete</span> <span class="kwrd">from</span> [Person].[CountryRegion] 
      <span class="kwrd">where</span> CountryRegionCode=@CountryRegionCode;
    <span class="kwrd">Insert</span> <span class="kwrd">into</span> [Person].[CountryRegion] 
    (CountryRegionCode,Name) <span class="kwrd">values</span> (@CountryRegionCode,@Name); 
<span class="kwrd">END</span>;</pre>
                                                        We can use the following SQL as the validating statement, 
                                                        <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">select</span> * <span class="kwrd">from</span> [Person].[CountryRegion] 
  <span class="kwrd">where</span> CountryRegionCode=@CountryCode</pre>
                                                        The whole steps are very easy. We can call the DML statement in setup process of test case, and then use the validating query as targetResultset statement. 
                                                        <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">unitTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="UT_Test_UpdateCountryRegion"</span> 
              <span class="attr">assertion</span><span class="kwrd">="RecordCountEqual"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">setup</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">statement</span> <span class="attr">statementAlias</span><span class="kwrd">="proc_UpdateCountryRegion"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryRegionCode"</span> <span class="attr">value</span><span class="kwrd">="ABC"</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@Name"</span> <span class="attr">value</span><span class="kwrd">="new country"</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">statement</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">setup</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">targetResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_GetCountryRegion"</span> 
                   <span class="attr">outputArgument</span><span class="kwrd">="@Return_Table"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="ABC"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">targetResultset</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">referenceResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="sql_get_const_number"</span> 
                      <span class="attr">outputArgument</span><span class="kwrd">="@result"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@constant"</span> <span class="attr">value</span><span class="kwrd">="1"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">referenceResultset</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">unitTestCase</span><span class="kwrd">&gt;</span></pre>                                                        
                                                        
  
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>    
                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Compare two record sets with different field count<a name="SheetCompRecordDiffCount" id="SheetCompRecordDiffCount"></a>
                                                            </h2>
                                                            Maybe you have noticed, In Quickstart we compared the record set of usp_GetAllStates and result set of usp_GetStatesInCountry. The result sets have the same field count and the same field names. You will ask question whether AnyDbTest can compare two record sets with different field count or field name.  Both of the answers are <strong>YES</strong>. 
                                                            <br />
                                                            <br />
                                                            Suppose that we have three stored procedures. usp_ GetStatesInCountry will output all fields of Person.StateProvince table; usp_GetStateBriefsInCountry will not output all fields of Person.StateProvince table; usp_GetStateBriefsInCountry_2 just is like usp_GetStateBriefsInCountry, except it rename the field name to StateProvinceName. 
                                                            <br />
                                                            <br />
                                                            In fact, such scenario is very common.  Sometimes this is desirable to ignore some columns to perform the comparison, particularly primary keys and time stamp columns.
                                                            <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
/*
Purpose: <span class="kwrd">To</span> <span class="kwrd">get</span> <span class="kwrd">all</span> <span class="kwrd">state</span> <span class="kwrd">in</span> <span class="kwrd">specific</span> country
*/
<span class="kwrd">drop</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStatesInCountry]
<span class="kwrd">go</span>
<span class="kwrd">create</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStatesInCountry]
@CountryCode <span class="kwrd">nchar</span>(3)
<span class="kwrd">AS</span>
<span class="kwrd">BEGIN</span>
<span class="kwrd">select</span> * <span class="kwrd">from</span> Person.StateProvince
<span class="kwrd">where</span>  CountryRegionCode=@CountryCode;
<span class="kwrd">END</span>;

<span class="kwrd">Go</span>

/*
Purpose: <span class="kwrd">To</span> <span class="kwrd">get</span> <span class="kwrd">all</span> <span class="kwrd">state</span> <span class="kwrd">in</span> <span class="kwrd">specific</span> country,
but <span class="kwrd">only</span> <span class="kwrd">output</span> brief info <span class="kwrd">of</span> one <span class="kwrd">state</span>,
such <span class="kwrd">as</span> StateProvinceID, StateProvinceCode, Name
*/
<span class="kwrd">drop</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStateBriefsInCountry]
<span class="kwrd">go</span>
<span class="kwrd">create</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStateBriefsInCountry]
@CountryCode <span class="kwrd">nchar</span>(3)
<span class="kwrd">AS</span>
<span class="kwrd">BEGIN</span>
<span class="kwrd">select</span> StateProvinceID, StateProvinceCode,
CountryRegionCode, Name
<span class="kwrd">from</span> Person.StateProvince
<span class="kwrd">where</span> CountryRegionCode=@CountryCode;
<span class="kwrd">END</span>;

<span class="kwrd">Go</span>

/*
Purpose: <span class="kwrd">To</span> <span class="kwrd">get</span> <span class="kwrd">all</span> <span class="kwrd">state</span> <span class="kwrd">in</span> <span class="kwrd">specific</span> country,
but <span class="kwrd">only</span> <span class="kwrd">output</span> brief info <span class="kwrd">of</span> one <span class="kwrd">state</span>,
such <span class="kwrd">as</span> StateProvinceID, StateProvinceCode, StateProvinceName
*/
<span class="kwrd">drop</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStateBriefsInCountry_2]
<span class="kwrd">go</span>
<span class="kwrd">create</span> <span class="kwrd">PROCEDURE</span> [Person].[usp_GetStateBriefsInCountry_2]
@CountryCode <span class="kwrd">nchar</span>(3)
<span class="kwrd">AS</span>
<span class="kwrd">BEGIN</span>
<span class="kwrd">select</span> StateProvinceID, StateProvinceCode,
CountryRegionCode, Name <span class="kwrd">as</span> StateProvinceName
<span class="kwrd">from</span> Person.StateProvince
<span class="kwrd">where</span>  CountryRegionCode=@CountryCode;
<span class="kwrd">END</span>;</pre>
                                                        We need pay attention to one rule. If we omit outputSetting section or no field listed in outputSetting section, AnyDbTest will compare all fields. Otherwise, AnyDbTest will only compare those fields appears in outputSetting section of each resultset.
                                                        <br />
                                                        <br />
                                                        Now, we want to compare two record sets with different field count, and to judge they are set-style equal each other or not. We should make sure they have the same amount of fields. The following XML is to compare two recordset with different field count. 
                                                        <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">unitTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="UT_Compare_Recordset_Diff_FieldCount"</span>
  <span class="attr">assertion</span><span class="kwrd">="SetEqual"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
    to demo how to compare two recordset with different field count
  <span class="kwrd">&lt;/</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">targetResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="proc_Get_state_in_country"</span>
    <span class="attr">outputArgument</span><span class="kwrd">="@Return_Table"</span> <span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceID"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="CountryRegionCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="Name"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">targetResultset</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">referenceResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="proc_GetStateBriefsInCountry"</span>
    <span class="attr">outputArgument</span><span class="kwrd">="@Return_Table"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceID"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="CountryRegionCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="Name"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">referenceResultset</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">unitTestCase</span><span class="kwrd">&gt;</span></pre> 
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>    
                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Compare two record sets with different field name<a name="SheetCompRecordDiffName" id="SheetCompRecordDiffName"></a>
                                                            </h2>
                                                            If you want, you can give every field an outputName in outputSetting section. If we don not give ouputName for one field, AnyDbTest will use field name as outputName by default. 
                                                            <br />
                                                            <br />
                                                            When comparing targetResultset and referenceResultset, AnyDbTest will compare all fields appeared in outputSetting of them. And every outputField of targetResultset will be compared with its counterpart outputField (owning the same outputField name) of referenceResultset.
                                                            <br />
                                                            <br />
                                                            The following XML is to compare two recordsets with different field name. Please pay attention to outputSetting section.
                                                            <br />
<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">unitTestCase</span> <span class="attr">testCaseName</span><span class="kwrd">="UT_Compare_Recordset_Diff_FieldName"</span>
  <span class="attr">assertion</span><span class="kwrd">="SetEqual"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
    to demo how to compare two recordset with different field name
  <span class="kwrd">&lt;/</span><span class="html">testCaseRemark</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">targetResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="proc_GetStateBriefsInCountry_2"</span>
    <span class="attr">outputArgument</span><span class="kwrd">="@Return_Table"</span> <span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceID"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="CountryRegionCode"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceName"</span>  <span class="attr">outputName</span><span class="kwrd">="StateProvinceName"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">targetResultset</span><span class="kwrd">&gt;</span>

  <span class="kwrd">&lt;</span><span class="html">referenceResultset</span> <span class="attr">statementAlias</span><span class="kwrd">="proc_GetStateBriefsInCountry"</span>
     <span class="attr">outputArgument</span><span class="kwrd">="@Return_Table"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">argument</span> <span class="attr">name</span><span class="kwrd">="@CountryCode"</span> <span class="attr">value</span><span class="kwrd">="US"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">inputArguments</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceID"</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="StateProvinceCode"</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="CountryRegionCode"</span><span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">field</span> <span class="attr">name</span><span class="kwrd">="Name"</span>  <span class="attr">outputName</span><span class="kwrd">="StateProvinceName"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">outputSetting</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">referenceResultset</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">unitTestCase</span><span class="kwrd">&gt;</span></pre>                                                            
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr> 
                                                
                                                <tr>
                                                    <td class="productText">
                                                    
                                                        <p align="justify">
                                                            <h2>
                                                                Show set-style and sequential-style comparison for unit test<a name="SheetShowDiffDialog" id="SheetShowDiffDialog"></a>
                                                            </h2>
                                                            After one unit test case ran by GUI Runner, we can click the diff button if we want to see differences highlighted on the screen between targetResultset and referenceResultset. GUI Runner will prompt one diff dialog, like the following figure. 
                                                            <br />
                                                            <a href="images/screenshots/big_UnitTestWithDiff.png">  
                                                            <img width="373" height="282" alt="Diff dialag" src="images/screenshots/small_UnitTestWithDiff.png" /></a>
                                                            <br />
                                                            In the diff dialog dialog, there are 5 buttons on the toolbar. They are Create changed diff file, Create common diff file, Create surplus diff file, Create absent diff file and Create sequence diff file. All kinds of diff files are html format, so you can use any web browser to view them, and you can share the diff files to other team members. 
                                                            <br />
                                                            <br />
                                                            Let us spend some time to know individual meaning of these buttons. The first 4 buttons can only be used the scenarios in where targetResultset and referenceResultset both are record sets. 
                                                            <br />
                                                            <br />
                                                            <strong>Create changed diff button</strong>, Computes the difference of targetResultset with referenceResultset. The difference of these two resultsets is all items that appear in one resultset, but not in another resultset. If an item appears X times in one resultset, and Y times in the another resultset, the difference contains the item X - Y times (zero times if Y >= X).
                                                            <br />
                                                            <br />
                                                            <strong>Create common diff file</strong>, Computes the intersection of targetResultset with referenceResultset. The intersection of two resultsets is all items that appear in both of the resultsets. If an item appears X times in one resultset, and Y times in the other one resultset, the intersection contains the item Minimum(X,Y) times.
                                                            <br />
                                                            <br />
                                                            <strong>Create surplus diff file</strong>, Computes the added parts in targetResultset over referenceResultset.
                                                            <br />
                                                            <br />
                                                            <strong>Create absent diff file</strong>, Computes the added parts in referenceResultset over targetResultset. 
                                                            <br />
                                                            <br />
                                                            <strong>Create sequence diff file</strong>, Computers the all difference of targetResultset with referenceResultset in the sequential comparison way. That is, the comparison will be done record by record.
                                                            <br />
                                                            <br />
                                                        </p>
                                                           
                                                        <div align="right">
                                                            <br />
                                                            <a href="#SheetCheatContent">&lt;&lt;Back to table of content&nbsp;&nbsp;&nbsp;</a><br />
                                                        </div>
                                                        
                                                    </td>
                                                </tr>     
                                                
                                                                                            
                                                </tr>                                                
                                                <tr>
                                                    <td height="37">
                                                        <span class="productButtons"><a href="product.html">
                                                            <img src="images/layout/more-button.jpg" alt="More Info" border="0" height="26" width="101">&nbsp; </a>&nbsp;&nbsp;&nbsp; <a href="download.html#DownloadAnyDbTest">
                                                                <img src="images/layout/download-button.jpg" alt="Download" border="0" height="26" width="101">&nbsp; </a>&nbsp;&nbsp;&nbsp; <a href="purchase.html#OrderSection">
                                                                    <img src="images/layout/purchase-button.jpg" alt="Purchase Now" border="0" height="26" width="101">&nbsp; </a></span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2">
                                                        <hr class="productSeparator">
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <br />
                                        <br />
                                        <!-- InstanceEndEditable -->
                                    </div>
                                </td>
                                <td background="images/layout/right-column-bg.gif" valign="top" width="226">
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody>
                                            <tr>
                                                <td class="rightColumn">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td valign="top">
                                                    <div class="RightColumnPadding">
                                                        <!-- InstanceBeginEditable name="RightRegion" -->
                                                                                                                <table border="0" cellpadding="0" cellspacing="0" width="96%">
                                                            <tbody>
                                                                <tr>
                                                                    <td width="5%">
                                                                        <img src="images/spacer.gif" height="8" width="8">
                                                                    </td>
                                                                    <td width="6%">
                                                                        <div align="center">
                                                                            <img src="images/dot.gif" height="10" width="14"></div>
                                                                    </td>
                                                                    <td class="rightColumnNavigation" width="89%">
                                                                        <a href="TutorialAboutUnitTesting.html">About Unit Testing</a>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td width="5%">
                                                                        <img src="images/spacer.gif" height="8" width="8">
                                                                    </td>
                                                                    <td width="6%">
                                                                        <div align="center">
                                                                            <img src="images/dot.gif" height="10" width="14"></div>
                                                                    </td>
                                                                    <td class="rightColumnNavigation" width="89%">
                                                                        <a href="TutorialQuickStart.html">Quick Start</a>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td width="5%">
                                                                        <img src="images/spacer.gif" height="8" width="8">
                                                                    </td>
                                                                    <td width="6%">
                                                                        <div align="center">
                                                                            <img src="images/dot.gif" height="10" width="14"></div>
                                                                    </td>
                                                                    <td class="rightColumnNavigation" width="89%">
                                                                        <a href="TutorialCheatSheet.html">Cheat Sheet</a>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td width="5%">
                                                                        <img src="images/spacer.gif" height="8" width="8">
                                                                    </td>
                                                                    <td width="6%">
                                                                        <div align="center">
                                                                            <img src="images/dot.gif" height="10" width="14"></div>
                                                                    </td>
                                                                    <td class="rightColumnNavigation" width="89%">
                                                                        <a href="TutorialReference.html">Reference</a>
                                                                    </td>
                                                                </tr>
																<!--
                                                                <tr>
                                                                    <td width="5%">
                                                                        <img src="images/spacer.gif" height="8" width="8">
                                                                    </td>
                                                                    <td width="6%">
                                                                        <div align="center">
                                                                            <img src="images/dot.gif" height="10" width="14"></div>
                                                                    </td>
                                                                    <td class="rightColumnNavigation" width="89%">
                                                                        <a href="TutorialTroubleshooting.html">Troubleshooting </a>
                                                                    </td>
                                                                </tr>
							-->									
                                                                <tr>
                                                                    <td colspan="3">
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </tbody>
                                                        </table>

                                                        <script type="text/javascript">
                                                        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
                                                        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
                                                        </script>
                                                        <script type="text/javascript">
                                                        try {
                                                        var pageTracker = _gat._getTracker("UA-8398936-1");
                                                        pageTracker._trackPageview();
                                                        } catch(err) {}</script>

                                                        <!-- InstanceEndEditable -->
                                                        <br />
                                                        <div align="center">

                                                            <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=160&h=60&title=&border=&output=js"></script>

                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                                <td width="9">
                                    &nbsp;
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="46" colspan="3" valign="middle" background="images/layout/site-border-bottom-full.gif" onfocus="MM_preloadImages('images/layout/site-border-bottom-full.gif')">
                    <table width="362" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="12" class="menuBottom">
                                &nbsp;
                            </td>
                            <td width="350" class="BottomLinks">
                                &nbsp;&nbsp; <a href="index.html">About AnyDbTest</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a href="license.html">Terms of Usage</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a href="privacy.html">Privacy Policy</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                                <!--
        		<a href="customers.html">Our Clients</a>
                -->
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="3" class="copyrightNotice">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="3" class="copyrightNotice">
                    <span class="copyrightNotice">Copyright &copy; 2008 - 2010 AnyDbTest Technology. All rights reserved.</span>
                </td>
            </tr>
            <tr>
                <td colspan="3" class="copyrightNoticeProducts">
                    <span class="copyrightNoticeProducts">AnyDbTest are trademarks or registered trademarks of AnyDbTest Technology.</span>
                </td>
            </tr>
        </tbody>
    </table>
    <br />
    <map name="Map" id="Map">
        <area shape="rect" coords="22,19,257,80" href="index.html" alt="AnyDbTest">
    </map>
    <!-- InstanceEnd -->
</body>
</html>
